<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pe="http://primefaces.org/ui/extensions" >
<h:head>
	<title>Hotel Composition</title>
</h:head>
<h:body>
	<h:link value="PERSONAL HOME" outcome="index" />
 	<h:form id="formAdd">
	<p:panel id="panelAddHotel" header="Hotel composition">  
        <p:messages id="msgs"/>
			
        <h:panelGrid columns="3">
			<h:outputLabel for="name" value="*Name: "></h:outputLabel>
			<p:inputText id="name" value="#{addHotel.hotel.name}" maxlength="45"
				required="true" requiredMessage="Please enter the hotel name." label="Name"/>
			<p:message for="name" display="icon"/>
			
			<h:outputLabel for="address" value="*Address: "></h:outputLabel>
			<p:inputText id="address" value="#{addHotel.hotel.address}" maxlength="45"
				required="true" requiredMessage="Please enter the hotel address." label="Address"/>
			<p:message for="address" display="icon"/>
			
			<h:outputLabel for="rating" value="Rating: "></h:outputLabel>
			<p:inputText id="rating" value="#{addHotel.hotel.rating}" label="Rating">
				 <p:slider for="rating" />
		 	</p:inputText>
			<p:message for="rating" display="icon"/>
			
			<h:outputLabel for="description" value="Description: "></h:outputLabel>
			<p:inputTextarea id="description" value="#{addHotel.hotel.description}" maxlength="1024" label="Description"
				rows="6" cols="36"/>
			<p:message for="description" display="icon"/> 	
				
			<h:outputLabel for="start" value="*Begin date: "></h:outputLabel>
			<p:calendar id="start" value="#{addHotel.hotel.startTrip}" pattern="dd/MM/yyyy HH:mm"
				required="true" requiredMessage="Please enter the begin date."
				converterMessage="Invalid begin date." label="Start date" >
				<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="GMT+1"/>
			</p:calendar>
			<p:message for="start" display="icon"/> 
				
			<h:outputLabel for="end" value="*End date: "></h:outputLabel>
			<p:calendar id="end" value="#{addHotel.hotel.endTrip}" pattern="dd/MM/yyyy HH:mm"
				required="true" requiredMessage="Please enter the end date."
				converterMessage="Invalid end date." label="End date" >
				<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="GMT+1"/>
			</p:calendar>
			<p:message for="end" display="icon"/> 
			
			<h:outputLabel for="maxAvailability" value="*Max availability:  "></h:outputLabel>
			<p:inputText id="maxAvailability" value="#{addHotel.hotel.maxAvailability}"
				required="true" requiredMessage="Please enter the max availability." label="Max availability" >
				 <p:slider for="maxAvailability" minValue="1"/>
			</p:inputText>
			<p:message for="maxAvailability" display="icon"/>
			
			<h:outputLabel for="price" value="*Price: "></h:outputLabel>
			<pe:inputNumber id="price" symbol="€" maxValue="1000000" symbolPosition="s" widgetVar="f6" value="#{addHotel.hotel.price}"
				decimalPlaces="2" required="true" requiredMessage="Please enter the price." label="Price" />
			<p:message for="price" display="icon"/>	
		</h:panelGrid>
		
		<p:commandButton id="buttonAddHotel" update="msgs" value="Compose hotel"
			action="#{addHotel.addHotel()}" />
	</p:panel>
	</h:form>
</h:body>
</html>